package com.thread.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * @author: may
 * @date: 2021年04月15日 21:59
 */
public class TestSingleThreadExecutor {
    public static void main(String[] args) {
        ExecutorService es = Executors.newSingleThreadExecutor();

        for (int i = 0; i < 5; i++) {
            final int j = i;
            es.execute(() -> {
                System.out.println(Thread.currentThread().getName() + "--" + j);
            });
        }
        es.shutdown();
        System.out.println(es);
    }
}
